﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Windows.Forms;
using System.IO;


namespace WindowsFormsApplication9
{
    class PersonList : ArrayList
    {
        DS_Net_Client ds_net = new DS_Net_Client();

        public readonly string filter;

        public PersonList()
        {
            ds_net.IsReady(".port");
            filter = ds_net.GetFilter();
        }

        public void Create()
        {

            for (int i = 0; i < this.Count; i++)
            {
                ds_net.Create((Person)this[i]);
            }
        }

        public void Read()
        {
            List<Person> pList = ds_net.Read();
            for (int i = 0; i < pList.Count; i++)
            {
                this.Add(pList[i]);
            }
        }

        public void Delete(int id)
        {
            ds_net.Delete(id);
        }

        public void Update(int id, Person _newPerson)
        {

            ds_net.Update(id, _newPerson);
        }
    }
}
